//app.js
App({
  globalData: {
    userInfo: null,
    token:'',
    tk_id:1,
    user_money:null,
    bjf_points:0,
    min_money:10,
    qrcodeUrl:"",
  },
  util:require('./utils/util.js'),
  onLaunch: function () {
   	this.globalData.userInfo = wx.getStorageSync('userInfo') || null;
  },
  
  getBalance:function(callback){
    let moneyValue = Number(this.globalData.user_money),
    	_this = this;
    if (moneyValue <= this.globalData.min_money) {
    	this.util.ajax({
	      url:"api/User/getUserMoney",
	    },function(data){
	      _this.globalData.user_money = data.data.data;
	      callback(data.data.data)
	    });
    }else{
    	callback(this.globalData.user_money)
    }
  },
  // 显示限制客服
  showServiceTips:function(money){
    let str = '该用户已设置姐付宝最低可用余额为'+money+'元 ,即可微信联系',
        _this = this;
    // wx.showToast({
    //   title:str,
    //   icon:'none',
    //   duration:3000
    // })
    wx.showModal({
      content:str,
      cancelText:"再想想",
      confirmText:"前往充值",
      success:function(res){
        if (res.confirm) {
          _this.util.pageJump('/pages/my/bjCurrency/bjCurrency');
        }
        
      }
    })
  }
})